﻿using System;

namespace NLite.Data
{
    public partial class Table:ITable
    {
        string ITable.TableName { get { return TableName; } }
        string ITable.TableAlias { get { return TableAlias; } }

        protected string TableName { get; private set; }
        protected string TableAlias { get; private set; }

        public Table(string name) : this(name, null) { }
        public Table(string name, string alias)
        {
            TableName = name;
            TableAlias = alias;
           
        }

        public Table()
        {
            TableName = GetType().Name;
        }

        public TColumn CreateColumn<TColumn>(string col) where TColumn:IColumnNode,new()
        {
            var ctor = typeof(TColumn).GetConstructor(new Type[] { typeof(string), typeof(string) });
            return (TColumn)ctor.Invoke(new object[]{ col,TableName});
        }

    }

    public partial class Database
    {
     
    }

    
}
